#
# from django.test import TestCase
#
import time
import datetime
#
# set = {1, 3, 5}
# set1 = {2, 3, 5}
# if set & set1:
#  print('hah')
import datetime

n_time = '2020-07-05'
# a = n_time.strptime("%Y%m%d")
# print(a)
#
# ts=time.strptime(n_time,"%Y-%m-%d")
# ts1=time.mktime(time.strptime(n_time,"%Y-%m-%d"))
# e_time = '2020-07-06'
# es=time.mktime(time.strptime(e_time,"%Y-%m-%d"))
# print(type(es), es)
# print(ts)
# print(ts1)
# dt1=datetime.datetime(ts[0],ts[1],ts[2])
# dt2=datetime.datetime(es[0],es[1],es[2])
# day = dt2 - dt1
# print(type(day.days), day.days)
#

# from datetime import datetime
# today = datetime.today()
# print(type(today), today)
#datetime.datetime(2018, 9, 8, 22, 32, 46)
# print(today.strftime('%Y-%m-%d'))
#'2018-09-08'
# print(today.strftime('%Y%m%d'))
#'20180908'
# today.strftime('%Y-%m')
#'2018-09'
# startDate = "2018-10-01"
# endDate = "2018-10-31"

###字符转化为日期
# startTime = datetime.datetime.strptime(startDate, '%Y-%m-%d')
# # endTime = datetime.datetime.strptime(endDate, '%Y-%m-%d')
# print(type(startTime), startTime)
# ss = startTime.strftime('%Y%m%d')
# print(type(ss), ss)
# print(type(endTime), endTime)
# sd = endTime.strftime('%Y%m%d')
# print(type(sd), sd)
# num = int(sd) - int(ss)
# print(num)
# now_time = datetime.datetime.now()
# now_time = now_time.strftime('%Y%m%d')
# print(type(now_time), now_time)

###日期转化为字符串
# print("--1---:" + datetime.datetime.strftime(startTime, "%Y-%m-%d"))
# print("--2---:" + datetime.datetime.strftime(endTime, "%Y-%m-%d"))
# end_date = '"2018-10-01"'
# start_date = '2018-11-01'
# day = time.strptime(end_date, "%Y-%m-%d") - time.strptime(start_date, "%Y-%m-%d")
# print(day.days)
start_date = '2012-02-05'
end_date = '2012-03-02'
today = datetime.date.today()
day = today + datetime.timedelta(days=30)
print(day)
d1 = datetime.datetime.strptime(start_date, '%Y-%m-%d').date()
print(type(d1), d1)
d2 = datetime.datetime.strptime(end_date, '%Y-%m-%d').date()
delta = d2 -d1
if d2 > d1:
    print(delta.days)
